package com.shd.edanpei.customer.bean;

import com.google.gson.annotations.SerializedName;
import com.shd.edanpei.base.network.model.NoDataResponse;
import com.shd.edanpei.common.Constant;

/**
 * Created by mc on 2018/5/18.
 */

public class PayInfoModel extends NoDataResponse {

    private int loanAmount;
    private int lastAmount;//终审金额
    private int orderType;
    private String repayTerm;
    private double depositAmount;
    private long depositPoints;
    private double serviceAmount;
    private long servicePoints;
    private long userPoints;
    private String alipay;
    private WeChatPayModel wechat;
    private int weChatCode;
    public  PayInfoModel(int code){
        this.weChatCode=code;
    }
    public  PayInfoModel(){}
    public int getWeChatCode() {
        return weChatCode;
    }

    public void setWeChatCode(int weChatCode) {
        this.weChatCode = weChatCode;
    }

    public WeChatPayModel getWechat() {
        return wechat;
    }

    public void setWechat(WeChatPayModel wechat) {
        this.wechat = wechat;
    }

    public String getAlipay() {
        return alipay;
    }

    public void setAlipay(String alipay) {
        this.alipay = alipay;
    }

    public String getLoanAmount() {
        return loanAmount + Constant.Unit.WANYUAN.getUnit();
    }


    public int getOrderType() {
        return orderType;
    }

    public void setOrderType(int orderType) {
        this.orderType = orderType;
    }

    public String getRepayTerm() {
        return "期限：" + repayTerm;
    }

    public String getPayAmount() {
        return depositAmount + Constant.Unit.YUAN.getUnit();
    }


    public String getHint(int type) {
        if (type == Constant.PayType.deposit.getType()) {
            return "当前积分" + userPoints + "，本次需要积分" + depositPoints + (userPoints < depositPoints ? "，积分不足" : "");
        } else {
            return "当前积分" + userPoints + "，本次需要积分" + servicePoints + (userPoints < servicePoints ? "，积分不足" : "");
        }
    }

    //积分是否足够支付
    public boolean ifCanIntegralPay(int type) {
        if (type == Constant.PayType.deposit.getType()) {
            return userPoints >= depositPoints ? true : false;
        } else {
            return userPoints >= servicePoints ? true : false;
        }
    }

    public static class WeChatPayModel {

        @SerializedName("package")
        private String packageX;
        private String appid;
        private String sign;
        private String partnerid;
        private String prepayid;
        private String noncestr;
        private String timestamp;

        public String getPackageX() {
            return packageX;
        }

        public String getAppid() {
            return appid;
        }

        public String getSign() {
            return sign;
        }

        public String getPartnerid() {
            return partnerid;
        }

        public String getPrepayid() {
            return prepayid;
        }

        public String getNoncestr() {
            return noncestr;
        }

        public String getTimestamp() {
            return timestamp;
        }

    }


}
